﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BaGiaDanhCuop
{
    public class ItemShop
    {
        Vector2 position;
        Texture2D image, border, details;
        Sprite image_Sprite;
        public bool isClick, isBuy, isSelect;
        public int price;


        public ItemShop(Texture2D img, Texture2D border, Texture2D details,int price, float x, float y)
        {
            position = new Vector2(x, y);
            this.image = img;
            this.border = border;
            this.details = details;
            this.image_Sprite = new Sprite(position, image);
            this.price = price;
            isClick = false;
            isBuy = false;
            isSelect = false;
        }

        public void Draw(SpriteBatch batch)
        {
            if (isClick)
            {
                image_Sprite.Draw(batch, SpriteEffects.None);
                batch.Draw(border, position, Color.White);
                batch.Draw(details, new Vector2(10, 190), Color.White);
            }
            else if (isClick == false && isBuy == false)
            {
                image_Sprite.Draw(batch, SpriteEffects.None);
            }
        }

        public void CheckTouch(double x, double y)
        {
            if (image_Sprite.contain(x, y) && isBuy == false)
            {
                isClick = true;
                isSelect = true;
            }
            else isClick = false;
        }
    }
}
